<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pm="http://primefaces.org/mobile" contentType="text/html"
	renderKitId="PRIMEFACES_MOBILE">

	<pm:page title="Components">

		
 <f:facet name="postinit">            
            <link rel="stylesheet" href="#{request.contextPath}/javax.faces.resource/calendar/calendar.css.jsf?ln=primefaces-mobile" />
            <h:outputScript library="primefaces-mobile" name="calendar/calendar.js" />            

        </f:facet>   



		<pm:view id="fileUpload" >
		 
		 	<pm:header title="Drop File">
				
				<pm:navBar>
					<p:button value="Send" icon="home" href="send-message.jsf?reverse=true" styleClass="ui-btn-active ui-state-persist"/>
					<p:button value="My Files" icon="info" href="myfiles.jsf?reverse=true"
						 />
					<p:button value="Admin" icon="search" href="admin.jsf?reverse=true" />
				</pm:navBar>
				
			</pm:header>
		 <pm:content>
                <h3>Step 1/2 </h3>
                
                Choose file to upload. 

                <h:form enctype="multipart/form-data">  

                      

                    <p:fileUpload value="#{dropFileMessage.file}" mode="simple"/> 

                    <p:commandButton value="Upload" ajax="false" actionListener="#{dropFileMessage.upload}"/>  
					
					<h:outputText id="uploadedFileName" value="#{dropFileMessage.file.fileName}"/>
					
					 <p:button rendered="#{not empty dropFileMessage.file.fileName}" value="Proceed to step 2/2" 
					 			href="#sendView?transition=turn" />
					 
                </h:form>                  
            </pm:content>
		</pm:view>



		
		

		<pm:view id="sendView" >
			<pm:header title="Drop File">
				<pm:navBar>
					<p:button value="Send" icon="home" href="send-message.jsf?reverse=true" styleClass="ui-btn-active ui-state-persist"/>
					<p:button value="My Files" icon="info" href="myfiles.jsf?reverse=true"
						 />
					<p:button value="Admin" icon="search" href="admin.jsf?reverse=true" />
				</pm:navBar>

			</pm:header>
			
            
			<h:form>
				<p:growl id="globalErrorMessages" showDetail="true"/>
            <pm:content>    
			 <h3>Step 2/2 </h3>
				
                
				
				<p:inputText id="to" label="Send to:" value="#{dropFileMessage.to}" required="true">
					 <p:ajax update="globalErrorMessages" event="keyup" />  
				</p:inputText>
				
			                                           

				
				<p:inputText label="Subject:" value="#{dropFileMessage.subject}"/>
				
				<p:inputTextarea id="inputTextarea" label="Message:" value="#{dropFileMessage.message}"/>
	
				
			
	  			
	 
	
	                                      
	            <label for="expDate">File will expire on : </label>
	            <p:calendar id="expDate" value="#{dropFileMessage.expiryDate}"   
	            	mindate="#{dropFileAdmin.minExpiryDate}" />
	
				<p:selectBooleanCheckbox 
				id="returnRecipt" value="#{dropFileMessage.returnRecipt}" 
								itemLabel="Return Recipt" />
	
	
				
				
				<p:selectBooleanCheckbox 
				id="deleteAfterDownload" value="#{dropFileMessage.deleteAfterDownload}" itemLabel="Delete After Download" />
				
				<p:selectBooleanCheckbox 
					id="publicMessage" value="#{dropFileMessage.publicMessage}" itemLabel="Public" />
				  
				  
	         	
				
				<p:commandButton value="Send!" icon="refresh" iconPos="right" action="#{dropFileMessage.send}" 
								update="globalErrorMessages" process="@form" 
								 
								>
	                    <f:attribute name="swatch" value="e" />
	            </p:commandButton>
	
	
	         	 
         	</pm:content>
	         </h:form>     
		</pm:view>



		<pm:view id="fileSent" >
			<pm:header title="Drop File">
				<pm:navBar>
					<p:button value="Send" icon="home" href="send-message.jsf?reverse=true" styleClass="ui-btn-active ui-state-persist"/>
					<p:button value="My Files" icon="info" href="myfiles.jsf?reverse=true"
						 />
					<p:button value="Admin" icon="search" href="admin.jsf?reverse=true" />
				</pm:navBar>

			</pm:header>
			
            
			<h:form>
				<p:growl id="globalErrorMessages" showDetail="true"/>
            <pm:content>    
			 <h3>File sent! </h3>
			
			<p:button value="Go to sent files" icon="search" href="sent.jsf" />
			
         	</pm:content>
	         </h:form>     
		</pm:view>

	</pm:page>

</f:view>
